{%include file="header.html"%}
<style>
input {	width: 240px;}
textarea {	width: 350px;	height: 100px;}
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>添加区域</h3>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="quyu.php" enctype="multipart/form-data" id="aspnetForm" name="form1">
    <table style=" width:100%;" cellpadding="0" cellspacing="0" class="table tb-type2">
      <tbody>
        <tr>
          <td class="firtd"> 区域名称:</td>
          <td>
          	<input type="text" name="r_name" id='r_name' {%if $res.r_id%} disabled="disabled" {%/if%} value="{%$res.r_name%}" required><br>
          	<span class="notice-span" id="users">支持中文、字母、数字的组合,2-20个字符</span>
          </td>
        </tr>
        <tr>
          <td class="firtd"> 是否开启:</td>
          <td><input style="width:15px" type="radio" name="r_zt" {%if $res.r_zt eq 0%}checked{%/if%} value="0"> 是 &nbsp;&nbsp;&nbsp;&nbsp;<input style="width:15px" {%if $res.r_zt eq 1%}checked{%/if%} type="radio" name="r_zt" value="1"> 否</td>
        </tr>
        <tr>
          <td class="style1">&nbsp;</td>
          <td>
          	  <input type="hidden" name="act" value="insert">
              <input type="hidden" name="r_id" id="r_id" value="{%$res.r_id%}">
              <a href="JavaScript:void(0);" class="btn" onclick="reset()"><span>重置</span></a>
              <a href="JavaScript:void(0);" class="btn" onclick="$('#tj').click()"><span>确认提交</span></a>
          </td>
        </tr>
      </tbody>
    </table>
    <input type="reset" id="cz" style="display: none;">
    <input type="submit" id="tj" style="display:none;";>
  </form>
</div>
</body>
<script>
    // 重置方法
    function reset(){
	$('input').val('');
	$('textarea').text('');
	$('select').val('');
}
$("#r_name").blur(function(){
  var name = $("#r_name").val();
  $.post("quyu.php",{act:'name',r_name:name},function(data){
    if(data==1){
      alert('区域名称已存在');
    }
  });
});
</script>
</html>